using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using BSU.CSCE.Services;
using BSU.CSCE.Utilities;
using BSU.CSCE.Web.Models;

namespace BSU.CSCE.Web.Controllers
{
    public abstract class BaseController : Controller
    {
        protected IConfiguration _configuration;
        protected Administrator _administrator;

        protected BaseController()
            : this(new Configuration(), new Administrator())
        { }

        protected BaseController(IConfiguration configuration, Administrator administrator)
        {
            _configuration = configuration;
            _administrator = administrator;
        }

        protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);
        }

        protected override void HandleUnknownAction(string actionName)
        {
            //throw new NotFoundException();
        }

        public string PreviousPageLink
        {
            get
            {
                if (string.IsNullOrEmpty(Request.QueryString["back"])) return null;
                return HttpUtility.UrlDecode(Request.QueryString["back"]);
            }
        }
    }
}
